<div class="widget" id="table-widget">
    <div class="top">
        <div class="title">
            <h1><?php echo $title; ?></h1>
        </div>
        <div class="down">
            <div class="left">
                <?php if($elementsPerPage): ?>
                    Количество элементов на странице: <?php echo $elementsPerPage; ?>
                <?php endif; ?>
            </div>
            <div class="right">
                <img src="<?php echo $ajaxLoadImg; ?>" class="ajax ajax-loader img" />
            </div>
        </div>
    </div>
    <div class="separator"></div>
    <div class="table">
        <table id="<?php echo $id; ?>" class="<?php echo $class; ?>">
            <thead>
            <tr>
                <?php foreach($columns as $column): ?>
                    <td>
                        <?php if(is_object($column)): ?>
                            <?php echo isset($column->href) ? $column->href : ''; ?>
                            <?php echo isset($column->filter) ? $column->filter : ''; ?>
                        <?php else: ?>
                            <?php echo $column; ?>
                        <?php endif; ?>
                    </td>
                <?php endforeach; ?>
            </tr>
            </thead>
            <tbody>
            <?php if($data): ?>
                <?php foreach($data as $num=>$value): ?>
                    <tr class="<?php echo $num%2==0 ?  'odd' : 'even'; ?>">
                        <?php foreach($columns as $column): ?>
                            <td>
                                <?php if(is_object($column) && isset($column->name)): ?>
                                    <?php $name=$column->name; ?>
                                    <?php echo $value->$name; ?>
                                <?php else: ?>
                                    <?php echo $value->$column; ?>
                                <?php endif; ?>
                            </td>
                        <?php endforeach; ?>
                    </tr>
                <?php endforeach; ?>
            <?php endif; ?>
            </tbody>
        </table>
    </div>
    <div class="bottom">
        <?php echo $pagination; ?>
    </div>

</div>